package com.corn.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/test")
public class TestServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.getWriter().write("Get");
        String idStr = req.getParameter("id");
        Integer id = Integer.parseInt(idStr);
        System.out.println(id);
        String name = req.getParameter("name");
        System.out.println(name);
        String ScoreStr = req.getParameter("score");
        Double score = Double.parseDouble(ScoreStr);
        System.out.println(score);
    }
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.getWriter().write("Post");
    }
}
